<?php  
//session_start();
include_once '../classeBDD/connectBdd.php';

$sql = sql::connect();
$donners= explode(';',isset($_GET['param']));
if(isset($_GET['param'])){
$donners= explode(';',$_GET['param']);
       for($i = 0; $i < sizeof($donners); ++$i){
          $table[strstr($donners[$i], '=', true)]=substr(strstr($donners[$i], '='),1);
    }}

if (isset($_POST['email'])) {
    $query = "INSERT INTO user(mail,mod_passe,etat_utilisateur) VALUES('".$_POST['email']."','".MD5($_POST['password'])."','0')";
    $query = $sql->query($query );
    $_SESSION['user']=$_POST['email'];
    if(isset($_GET['param']))
        echo '<script language="Javascript">document.location.replace("./action_annonce.php?param='.$_GET['param'].'");</script>';
    else echo '<script language="Javascript"> document.location.replace("./"); </script>';
    die;;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
		<title>Jquery Inline Form Validation Engine</title>
		<link rel="stylesheet" href="/css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
		<link rel="stylesheet" href="/css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
		<script src="/jquery/jquery.min.js" type="text/javascript"></script>
                <script  type="text/javascript" src="/jquery/verif_pwd.js"></script>
		<script src="/jquery/jquery.validationEngine-en.js" type="text/javascript"></script>
		<script src="/jquery/jquery.validationEngine.js" type="text/javascript"></script>

		<!-- AJAX SUCCESS TEST FONCTION	
			<script>function callSuccessFunction(){alert("success executed")}
					function callFailFunction(){alert("fail executed")}
			</script>
		-->
		
		<script>	
		$(document).ready(function() {

			
			$("#formID").validationEngine()
		
			
			//$.validationEngine.loadValidation("#date")
			//alert($("#formID").validationEngine({returnIsValid:true}))
			//$.validationEngine.buildPrompt("#date","This is an example","error")	 		 // Exterior prompt build example
			//$.validationEngine.closePrompt(".formError",true) 							// CLOSE ALL OPEN PROMPTS
		});
		
		// JUST AN EXAMPLE OF CUSTOM VALIDATI0N FUNCTIONS : funcCall[validate2fields]
		function validate2fields(){
			if($("#firstname").val() =="" ||  $("#lastname").val() == ""){
				return false;
			}else{
				return true;
			}
		}
	</script>	
<title>Document sans titre</title>
</head>
<body>
    <form  class="formular" method="post" action="" id="formID" onsubmit="signin(this.pseudo.value,this.email.value,this.password1.value,this.password2.value,this.code.value);return false" enctype="multipart/form-data">
        <fieldset>
            <legend>Creer votre compte</legend>
            <fieldset>
                <legend><?php if(isset($message))echo $message;?></legend>
                <span>Email<br/></span><label><input value="<?php if(isset($table['mail'])) echo $table['mail'];?>"  class="validate[required,custom[email]] text-input" type="text" name="email" id="email" /><br/></label>
                <label>
		  <span>Password : </span>
		  <input value=""  class="validate[required,length[6,11]] text-input" type="password" name="password"  id="password" />
	        </label>
	        <label>
		  <span>Confirm password : </span>
		  <input value=""  class="validate[required,confirm[password]] text-input" type="password" name="password2"  id="password2" />
		</label>

            </fieldset>
              <span><input name="btnConnexion" type="submit" id="btnConnexion" value="Connexion" /></span>
             
        </fieldset>
    </form>
</body>
</html>
















